/*
 * Copyright (c) 2024-2025 iSOFT INFRASTRUCTURE SOFTWARE CO., LTD.
 * easyAda is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#ifndef __UAPI_IPCOPS_H__
#define __UAPI_IPCOPS_H__

#include <stdlib/stdint.h>

enum cap_ntfn_operation { CAP_NTFN_OP_WAIT, CAP_NTFN_OP_SIGNAL, CAP_NTFN_OP_CANCEL };

enum cap_ep_operation {
    CAP_EP_OP_SEND,
    CAP_EP_OP_RECV,
    CAP_EP_OP_CALL,
    CAP_EP_OP_REPLY,
    CAP_EP_OP_CANCEL,
};

enum cap_irq_operation { CAP_IRQ_OP_GET, CAP_IRQ_OP_PUT, CAP_IRQ_OP_WAIT, CAP_IRQ_OP_ACK, CAP_IRQ_OP_ACK_WAIT };

enum cap_ram_operation {
    CAP_RAM_MKCAP,
    CAP_RAM_FREE,
    CAP_RAM_MAP,
};

enum cap_addrspace_operation { CAP_ADDRS_INIT, CAP_ADDRS_COPY, CAP_ADDRS_MAP, CAP_ADDRS_UNMAP };

enum cap_task_operation {
    CAP_THREAD_CONFIG,
    CAP_THREAD_CLONE,
    CAP_THREAD_JOIN,
    CAP_THREAD_DETACH,
    CAP_THREAD_OPTION,
    CAP_THREAD_CORE_STATE,
    CAP_THREAD_INFO_MEMORY,
    CAP_THREAD_MM_HEAP_ADDRESS,
    CAP_THREAD_SBRK,
    CAP_THREAD_BRK,
    CAP_THREAD_EXIT,
    CAP_THREAD_YIELD,
    CAP_THREAD_BLOCK,
    CAP_THREAD_SOFT_BLOCK,
    CAP_THREAD_NANOSLEEP,
    CAP_THREAD_USLEEP,
    CAP_THREAD_CPU_USAGE,
    CAP_THREAD_SETUID,
    CAP_THREAD_SETEUID,
    CAP_THREAD_SETGID,
    CAP_THREAD_SETEGID,
    CAP_THREAD_GETUID,
    CAP_THREAD_GETEUID,
    CAP_THREAD_GETGID,
    CAP_THREAD_GETEGID,
    CAP_THREAD_MIGRATE,
    CAP_SET_ELF_HEAP,
    CAP_THREAD_leave,
};

enum cap_mutex_operation {
    CAP_MUTEX_OP_LOCK,
    CAP_MUTEX_OP_UNLOCK,
    CAP_MUTEX_OP_TRYLOCK,
    CAP_MUTEX_OP_OWNER,
    CAP_MUTEX_OP_DESTROY,
};

enum cap_cond_operation {
    CAP_COND_OP_TIMED_WAIT,
    CAP_COND_OP_SIGNAL,
    CAP_COND_OP_BROADCAST,
    CAP_COND_OP_DESTROY,
};

typedef struct {
    int32_t       sig_num;        ///< signal number
    cptr_t        cptr;           ///< cptr
    uintptr_t     common_func;    ///< the common functions related to signal handling
    int32_t       how;            ///< method of signal handling
    uint64_t     *set;            ///< pointer to a signal set to be modified
    uint64_t     *old_set;        ///< pointer to store the old signal set
    uint64_t      timeout;        ///< timeout value
    uintptr_t    *info;           ///< pointer to additional information or data
    uint8_t       ignore;         ///< ignore signal flag
    uint32_t      sender_pid;     ///< signal sender pid
    union sigval *sigvalue;       ///< signal value
    int32_t       si_code;        ///< signal code
} op_signal_param_t;

#endif
